using System;
using System.Collections.Generic;
using axCommerce.Data.Interface;

namespace axCommerce.Data
{
	public partial class Photo : IComparable<Photo>, ISimpleData
	{
		public static List<Photo> GetAllPhotos(int iProductId)
		{
			return Search(new Photo
			              	{
			              		ProductId = iProductId
			              	});
		}

		public void Save()
		{
			CreatedDate = DateTime.Now;
			LastModifiedDate = DateTime.Now;
			IsDeleted = false;

			Insert();
		}

		public void UpdateInstance()
		{
			LastModifiedDate = DateTime.Now;

			Update();
		}

		public void MarkAsDeleted()
		{
			LastModifiedDate = DateTime.Now;
			IsDeleted = true;

			Update();
		}

		public int CompareTo(Photo other)
		{
			return FileName.CompareTo(other.FileName);
		}
	}
}

